The Accordion Pane Component > FAccordionPane.sortItemsBy()

 

FAccordionPane.sortItemsBy()

Availability

Flash Player 6.

Usage

myAccordion_acp.sortItemsBy (field [, order])

Parameters

field A string specifying the field that the component should be sorted by.
order An optional string, which if specified and set to "DESC" will sort the component in descending order.

Returns


Nothing

Description

This methods sorts the component by the field specified in the first parameter. The fields used by the component are "label" and "linkage", although it is possible to define additional fields and sort by those. If "DESC" is passed in as the second parameter, the component will be sorted in descending order. Otherwise, the component sorts in ascending order.

 

Example

The accordion_setTransitionTime.fla example file contains an example of using this method.

The following 2 code examples, show two example of sorting sections within the component.

var sections = ["ABC","CBA","BCA"];
myAccordionPane_acp.setDataProvider(sections);
myAccordionPane_acp.sortItemsBy("label");


//another example
var dp = new DataProviderClass();
dp.addItem({label: "Section 1", order: "A"});
dp.addItem({label: "Section 2", order: "B"});
dp.addItem({label: "Section 3", order: "C"});	
myAccordionPane_acp.setDataProvider(dp);
myAccordionPane_acp.sortItemsBy("order", "DESC");